package com.example.mapp;

import com.example.entity.supervision.CheckItem;
import com.example.mapp.buildSql.SupervisionMappSql;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * Created by simon on 2018/8/7.
 */
@Mapper
public interface CheckItemMapp {

    @Insert(" insert into check_item (item_type,item_name,item_no,is_use,item_content,ad_dict_id, ext1,ext2) " +
            " value (#{itemType},#{itemName},#{itemNo},#{isUse},#{itemContent},#{adDictId},#{ext1},#{ext2})")
    @SelectKey(statement = "select last_insert_id()", keyProperty = "id", keyColumn = "id", before = false, resultType = Long.class)
    int insert(CheckItem checkItem) throws Exception;

    @Update("delete from check_item where id=#{id} ")
    int closeOrOpen(Map planDict) throws Exception;

    @SelectProvider(type = SupervisionMappSql.class, method = "queryCheckItem")
    List<CheckItem> query(Map map) throws Exception;

    // 查询维保检查项
    @SelectProvider(type = SupervisionMappSql.class, method = "spotCheckItem")
    List<CheckItem> querySpotCheckItem(Map map) throws Exception;
}
